Optimal. Leaf size=129 \[ \frac {d^2 x}{b^2}+\frac {2 (b c-a d) \left (a b c+a^2 d-2 b^2 d\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{b^2 \left (a^2-b^2\right )^{3/2} f}+\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))} \]
[Out]
________________________________________________________________________________________
Rubi [A]
time = 0.16, antiderivative size = 129, normalized size of antiderivative = 1.00, number of steps
used = 5, number of rules used = 5, integrand size = 25, \(\frac {\text {number of rules}}{\text {integrand size}}\) = 0.200, Rules used = {2869, 2814,
2739, 632, 210} \begin {gather*} \frac {2 (b c-a d) \left (a^2 d+a b c-2 b^2 d\right ) \text {ArcTan}\left (\frac {a \tan \left (\frac {1}{2} (e+f x)\right )+b}{\sqrt {a^2-b^2}}\right )}{b^2 f \left (a^2-b^2\right )^{3/2}}+\frac {(b c-a d)^2 \cos (e+f x)}{b f \left (a^2-b^2\right ) (a+b \sin (e+f x))}+\frac {d^2 x}{b^2} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
Rule 210
Rule 632
Rule 2739
Rule 2814
Rule 2869
Rubi steps
\begin {align*} \int \frac {(c+d \sin (e+f x))^2}{(a+b \sin (e+f x))^2} \, dx &=\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))}+\frac {\int \frac {-b \left (2 b c d-a \left (c^2+d^2\right )\right )+\left (a^2-b^2\right ) d^2 \sin (e+f x)}{a+b \sin (e+f x)} \, dx}{b \left (a^2-b^2\right )}\\ &=\frac {d^2 x}{b^2}+\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))}+\frac {\left ((b c-a d) \left (a b c+a^2 d-2 b^2 d\right )\right ) \int \frac {1}{a+b \sin (e+f x)} \, dx}{b^2 \left (a^2-b^2\right )}\\ &=\frac {d^2 x}{b^2}+\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))}+\frac {\left (2 (b c-a d) \left (a b c+a^2 d-2 b^2 d\right )\right ) \text {Subst}\left (\int \frac {1}{a+2 b x+a x^2} \, dx,x,\tan \left (\frac {1}{2} (e+f x)\right )\right )}{b^2 \left (a^2-b^2\right ) f}\\ &=\frac {d^2 x}{b^2}+\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))}-\frac {\left (4 (b c-a d) \left (a b c+a^2 d-2 b^2 d\right )\right ) \text {Subst}\left (\int \frac {1}{-4 \left (a^2-b^2\right )-x^2} \, dx,x,2 b+2 a \tan \left (\frac {1}{2} (e+f x)\right )\right )}{b^2 \left (a^2-b^2\right ) f}\\ &=\frac {d^2 x}{b^2}+\frac {2 (b c-a d) \left (a b c+a^2 d-2 b^2 d\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{b^2 \left (a^2-b^2\right )^{3/2} f}+\frac {(b c-a d)^2 \cos (e+f x)}{b \left (a^2-b^2\right ) f (a+b \sin (e+f x))}\\ \end {align*}
________________________________________________________________________________________
Mathematica [A]
time = 0.61, size = 133, normalized size = 1.03 \begin {gather*} \frac {d^2 (e+f x)-\frac {2 \left (2 b^3 c d+a^3 d^2-a b^2 \left (c^2+2 d^2\right )\right ) \tan ^{-1}\left (\frac {b+a \tan \left (\frac {1}{2} (e+f x)\right )}{\sqrt {a^2-b^2}}\right )}{\left (a^2-b^2\right )^{3/2}}+\frac {b (b c-a d)^2 \cos (e+f x)}{(a-b) (a+b) (a+b \sin (e+f x))}}{b^2 f} \end {gather*}
Antiderivative was successfully verified.
[In]
[Out]
________________________________________________________________________________________
Maple [A]
time = 0.30, size = 220, normalized size = 1.71
method | result | size |
derivativedivides | \(\frac {-\frac {2 \left (\frac {-\frac {b^{2} \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (a^{2}-b^{2}\right ) a}-\frac {b \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right )}{a^{2}-b^{2}}}{a \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+2 b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+a}+\frac {\left (a^{3} d^{2}-a \,b^{2} c^{2}-2 a \,b^{2} d^{2}+2 b^{3} c d \right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a^{2}-b^{2}\right )^{\frac {3}{2}}}\right )}{b^{2}}+\frac {2 d^{2} \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{b^{2}}}{f}\) | \(220\) |
default | \(\frac {-\frac {2 \left (\frac {-\frac {b^{2} \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \tan \left (\frac {f x}{2}+\frac {e}{2}\right )}{\left (a^{2}-b^{2}\right ) a}-\frac {b \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right )}{a^{2}-b^{2}}}{a \left (\tan ^{2}\left (\frac {f x}{2}+\frac {e}{2}\right )\right )+2 b \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+a}+\frac {\left (a^{3} d^{2}-a \,b^{2} c^{2}-2 a \,b^{2} d^{2}+2 b^{3} c d \right ) \arctan \left (\frac {2 a \tan \left (\frac {f x}{2}+\frac {e}{2}\right )+2 b}{2 \sqrt {a^{2}-b^{2}}}\right )}{\left (a^{2}-b^{2}\right )^{\frac {3}{2}}}\right )}{b^{2}}+\frac {2 d^{2} \arctan \left (\tan \left (\frac {f x}{2}+\frac {e}{2}\right )\right )}{b^{2}}}{f}\) | \(220\) |
risch | \(\frac {d^{2} x}{b^{2}}-\frac {2 i \left (a^{2} d^{2}-2 a b c d +b^{2} c^{2}\right ) \left (i b +a \,{\mathrm e}^{i \left (f x +e \right )}\right )}{b^{2} \left (a^{2}-b^{2}\right ) f \left (-i b \,{\mathrm e}^{2 i \left (f x +e \right )}+i b +2 a \,{\mathrm e}^{i \left (f x +e \right )}\right )}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a^{3} d^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f \,b^{2}}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a \,c^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a \,d^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}-\frac {2 b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a +a^{2}-b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c d}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a^{3} d^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f \,b^{2}}-\frac {\ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a \,c^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}-\frac {2 \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) a \,d^{2}}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}+\frac {2 b \ln \left ({\mathrm e}^{i \left (f x +e \right )}+\frac {i \sqrt {-a^{2}+b^{2}}\, a -a^{2}+b^{2}}{\sqrt {-a^{2}+b^{2}}\, b}\right ) c d}{\sqrt {-a^{2}+b^{2}}\, \left (a +b \right ) \left (a -b \right ) f}\) | \(761\) |
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Maxima [F(-2)]
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Exception raised: ValueError} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Fricas [B] Leaf count of result is larger than twice the leaf count of optimal. 295 vs.
\(2 (127) = 254\).
time = 0.40, size = 682, normalized size = 5.29 \begin {gather*} \left [\frac {2 \, {\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d^{2} f x \sin \left (f x + e\right ) + 2 \, {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d^{2} f x + {\left (a^{2} b^{2} c^{2} - 2 \, a b^{3} c d - {\left (a^{4} - 2 \, a^{2} b^{2}\right )} d^{2} + {\left (a b^{3} c^{2} - 2 \, b^{4} c d - {\left (a^{3} b - 2 \, a b^{3}\right )} d^{2}\right )} \sin \left (f x + e\right )\right )} \sqrt {-a^{2} + b^{2}} \log \left (-\frac {{\left (2 \, a^{2} - b^{2}\right )} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2} - 2 \, {\left (a \cos \left (f x + e\right ) \sin \left (f x + e\right ) + b \cos \left (f x + e\right )\right )} \sqrt {-a^{2} + b^{2}}}{b^{2} \cos \left (f x + e\right )^{2} - 2 \, a b \sin \left (f x + e\right ) - a^{2} - b^{2}}\right ) + 2 \, {\left ({\left (a^{2} b^{3} - b^{5}\right )} c^{2} - 2 \, {\left (a^{3} b^{2} - a b^{4}\right )} c d + {\left (a^{4} b - a^{2} b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right )}{2 \, {\left ({\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} f \sin \left (f x + e\right ) + {\left (a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6}\right )} f\right )}}, \frac {{\left (a^{4} b - 2 \, a^{2} b^{3} + b^{5}\right )} d^{2} f x \sin \left (f x + e\right ) + {\left (a^{5} - 2 \, a^{3} b^{2} + a b^{4}\right )} d^{2} f x - {\left (a^{2} b^{2} c^{2} - 2 \, a b^{3} c d - {\left (a^{4} - 2 \, a^{2} b^{2}\right )} d^{2} + {\left (a b^{3} c^{2} - 2 \, b^{4} c d - {\left (a^{3} b - 2 \, a b^{3}\right )} d^{2}\right )} \sin \left (f x + e\right )\right )} \sqrt {a^{2} - b^{2}} \arctan \left (-\frac {a \sin \left (f x + e\right ) + b}{\sqrt {a^{2} - b^{2}} \cos \left (f x + e\right )}\right ) + {\left ({\left (a^{2} b^{3} - b^{5}\right )} c^{2} - 2 \, {\left (a^{3} b^{2} - a b^{4}\right )} c d + {\left (a^{4} b - a^{2} b^{3}\right )} d^{2}\right )} \cos \left (f x + e\right )}{{\left (a^{4} b^{3} - 2 \, a^{2} b^{5} + b^{7}\right )} f \sin \left (f x + e\right ) + {\left (a^{5} b^{2} - 2 \, a^{3} b^{4} + a b^{6}\right )} f}\right ] \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Sympy [F(-1)] Timed out
time = 0.00, size = 0, normalized size = 0.00 \begin {gather*} \text {Timed out} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Giac [A]
time = 0.61, size = 249, normalized size = 1.93 \begin {gather*} \frac {\frac {{\left (f x + e\right )} d^{2}}{b^{2}} + \frac {2 \, {\left (a b^{2} c^{2} - 2 \, b^{3} c d - a^{3} d^{2} + 2 \, a b^{2} d^{2}\right )} {\left (\pi \left \lfloor \frac {f x + e}{2 \, \pi } + \frac {1}{2} \right \rfloor \mathrm {sgn}\left (a\right ) + \arctan \left (\frac {a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + b}{\sqrt {a^{2} - b^{2}}}\right )\right )}}{{\left (a^{2} b^{2} - b^{4}\right )} \sqrt {a^{2} - b^{2}}} + \frac {2 \, {\left (b^{3} c^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) - 2 \, a b^{2} c d \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a^{2} b d^{2} \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a b^{2} c^{2} - 2 \, a^{2} b c d + a^{3} d^{2}\right )}}{{\left (a^{3} b - a b^{3}\right )} {\left (a \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right )^{2} + 2 \, b \tan \left (\frac {1}{2} \, f x + \frac {1}{2} \, e\right ) + a\right )}}}{f} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________
Mupad [B]
time = 15.47, size = 2500, normalized size = 19.38 \begin {gather*} \text {Too large to display} \end {gather*}
Verification of antiderivative is not currently implemented for this CAS.
[In]
[Out]
________________________________________________________________________________________